﻿using System;
using NDBGen.Descriptors.Columns.Tokens;
using NDBGen.Plugins.DataAccess;

namespace NDBGen.Plugins.Descriptors.Columns.Tokens
{
    [ColumnTokenCodeSnippetGenerator(typeof(DataMemberTokenDescriptor))]
    public sealed class DotNetDataMemberTokenCodeGenerator : DotNetColumnTokenCodeGeneratorBase<DataMemberTokenDescriptor>
    {
        protected override Object[] GenerateCustomAttributes()
        {
            var camelCase =
                this.Descriptor.Column.Name.Substring(0, 1).ToLower() +
                this.Descriptor.Column.Name.ToPascalCase().Substring(1);

            return new Object[]
            {
                ColumnMetadataHelper.CustomAttributes.DataMemberFormat.SetArgs(camelCase.Replace("iD", "id"))
            };
        }
    }
}